<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user', function (Blueprint $table) {
            $table->increments('id');
            $table->string("mobile",20)->default('')->comment("手机号码");
            $table->string("password",32)->default('')->comment("登录密码");
            $table->string("avatar",150)->default('')->comment("头像");
            $table->string("nickname",100)->default('')->comment("昵称");
            $table->string("openid",40)->default('')->comment("openid");
            $table->string("unionid",40)->default('')->comment("unionid");
            $table->integer("invite_id")->default(0)->comment("邀请人ID");
            $table->string("app_name",20)->default('')->comment("APP名称");
            $table->string("last_ip",20)->default('')->comment("最后登录IP");
            $table->dateTime("last_time")->comment("最后登录时间");
            $table->mediumInteger("login_count")->default(0)->comment("登录次数");
            $table->string("app_platform",20)->default('')->comment("注册平台,android,ios,weixin,other");
            $table->string("app_channel",20)->default('')->comment("注册渠道(应用市场)");
            $table->string("app_version",20)->default('')->comment("APP版本");
            $table->string("imei",80)->default('')->comment("唯一识别码，ios = idfa，android = imei");
            $table->integer("user_status")->default(1)->comment("用户状态,1-正常,2-禁用");
            $table->integer("is_deleted")->default(0)->comment("是否删除");
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user');
    }
}
